//
//  YXConfigure.swift
//  swift_wobo
//
//  Created by yuxin on 2018/12/1.
//  Copyright © 2018 wuxiantianli. All rights reserved.
//

import UIKit

class YXConfigure: NSObject {
    class func randomColor() -> UIColor {
        let color = UIColor.init(red: CGFloat(arc4random() % 256) / 255, green: CGFloat(arc4random() % 256) / 255, blue: CGFloat(arc4random() % 256) / 255, alpha: 1.0)
        return color
    }

    static var screenWidth = UIScreen.main.bounds.size.width
    static var screenHeight = UIScreen.main.bounds.size.height
    
    static var playerHeight = (UIScreen.main.bounds.size.width * 9/16)
    
    static var naviHeight: CGFloat = 44
    static var statusbarHeight: CGFloat = (isLiuHaiScreen ? 40 : 20)
    static var tabbrHeight: CGFloat = (isLiuHaiScreen ? (49+34) : 49)
    
    
    //是否刘海屏
    static var isLiuHaiScreen: Bool {
        if #available(iOS 11, *) {
            guard let w = UIApplication.shared.delegate?.window, let unwrapedWindow = w else {
                return false
            }
            
            if unwrapedWindow.safeAreaInsets.left > 0 || unwrapedWindow.safeAreaInsets.bottom > 0 {
                print(unwrapedWindow.safeAreaInsets)
                return true
            }
        }
        return false
    }
}




